From c9d6d0222cb1229447cdf7e6b86cf15251fbb7f4 Mon Sep 17 00:00:00 2001 From: robertl Date: Fri, 5 May 2006 20:37:41 +0000 Subject: [PATCH] Make character encoding tables optional at build time. --- gpsbabel/cet_util.c | 80 ++++++++++++++++++++++++------------------- gpsbabel/config.h.in | 3 ++ gpsbabel/configure | 67 +++++++++++++++++++++++++++++++----- gpsbabel/configure.in | 9 +++++ 4 files changed, 114 insertions(+), 45 deletions(-) diff --git a/gpsbabel/cet_util.c b/gpsbabel/cet_util.c index d5ee5c8f3..800051cac 100644 --- a/gpsbabel/cet_util.c +++ b/gpsbabel/cet_util.c @@ -205,12 +205,11 @@ cet_valid_char(const char *src, const cet_cs_vec_t *vec) } /* %%% include character set headers %%% */ - -#include "cet/ansi_x3_4_1968.h" -#include "cet/atarist.h" -#include "cet/baltic.h" -#include "cet/bs_4730.h" -#include "cet/bs_viewdata.h" +#if defined (CET_WANTED) +#include "cet/iso_8859_2.h" +#include "cet/cp1250.h" +#include "cet/latin_greek_1.h" +#include "cet/macintosh.h" #include "cet/cp1250.h" #include "cet/cp1251.h" #include "cet/cp1252.h" @@ -219,6 +218,44 @@ cet_valid_char(const char *src, const cet_cs_vec_t *vec) #include "cet/cp1255.h" #include "cet/cp1256.h" #include "cet/cp1257.h" +#include "cet/ibm437.h" +#include "cet/ibm850.h" +#include "cet/ibm851.h" +#include "cet/ibm852.h" +#include "cet/ibm855.h" +#include "cet/ibm857.h" +#include "cet/ibm860.h" +#include "cet/ibm861.h" +#include "cet/ibm862.h" +#include "cet/ibm863.h" +#include "cet/ibm864.h" +#include "cet/ibm865.h" +#include "cet/ibm868.h" +#include "cet/ibm869.h" +#include "cet/iso_8859_1.h" +#include "cet/iso_8859_10.h" +#include "cet/iso_8859_13.h" +#include "cet/iso_8859_14.h" +#include "cet/iso_8859_15.h" +#include "cet/iso_8859_2.h" +#include "cet/iso_8859_3.h" +#include "cet/iso_8859_4.h" +#include "cet/iso_8859_5.h" +#include "cet/iso_8859_6.h" +#include "cet/iso_8859_7.h" +#include "cet/iso_8859_8.h" +#include "cet/iso_8859_9.h" +#include "cet/koi8_r.h" +#include "cet/koi8_ru.h" +#include "cet/koi_8.h" +#endif + +#if CET_WANTED +#include "cet/ansi_x3_4_1968.h" +#include "cet/atarist.h" +#include "cet/baltic.h" +#include "cet/bs_4730.h" +#include "cet/bs_viewdata.h" #include "cet/csa_z243_4_1985_1.h" #include "cet/csa_z243_4_1985_2.h" #include "cet/csa_z243_4_1985_gr.h" @@ -245,21 +282,7 @@ cet_valid_char(const char *src, const cet_cs_vec_t *vec) #include "cet/ibm284.h" #include "cet/ibm285.h" #include "cet/ibm297.h" -#include "cet/ibm437.h" #include "cet/ibm500.h" -#include "cet/ibm850.h" -#include "cet/ibm851.h" -#include "cet/ibm852.h" -#include "cet/ibm855.h" -#include "cet/ibm857.h" -#include "cet/ibm860.h" -#include "cet/ibm861.h" -#include "cet/ibm862.h" -#include "cet/ibm863.h" -#include "cet/ibm864.h" -#include "cet/ibm865.h" -#include "cet/ibm868.h" -#include "cet/ibm869.h" #include "cet/ibm871.h" #include "cet/ibm891.h" #include "cet/ibm903.h" @@ -269,19 +292,6 @@ cet_valid_char(const char *src, const cet_cs_vec_t *vec) #include "cet/iso_5427.h" #include "cet/iso_646_irv.h" #include "cet/iso_6937_2_25.h" -#include "cet/iso_8859_1.h" -#include "cet/iso_8859_10.h" -#include "cet/iso_8859_13.h" -#include "cet/iso_8859_14.h" -#include "cet/iso_8859_15.h" -#include "cet/iso_8859_2.h" -#include "cet/iso_8859_3.h" -#include "cet/iso_8859_4.h" -#include "cet/iso_8859_5.h" -#include "cet/iso_8859_6.h" -#include "cet/iso_8859_7.h" -#include "cet/iso_8859_8.h" -#include "cet/iso_8859_9.h" #include "cet/iso_8859_supp.h" #include "cet/it.h" #include "cet/jis_c6220_1969_ro.h" @@ -290,11 +300,8 @@ cet_valid_char(const char *src, const cet_cs_vec_t *vec) #include "cet/jus_i_b1_003_mac.h" #include "cet/jus_i_b1_003_serb.h" #include "cet/keybcs2.h" -#include "cet/koi8_r.h" -#include "cet/koi8_ru.h" #include "cet/koi8_u.h" #include "cet/koi_7.h" -#include "cet/koi_8.h" #include "cet/koi_8_cs2.h" #include "cet/ksc5636.h" #include "cet/latin_greek_1.h" @@ -318,6 +325,7 @@ cet_valid_char(const char *src, const cet_cs_vec_t *vec) #include "cet/tcvn.h" #include "cet/viscii.h" #include "cet/vps.h" +#endif #ifdef DEBUG_MEM diff --git a/gpsbabel/config.h.in b/gpsbabel/config.h.in index f0ff994a3..e20a847d6 100644 --- a/gpsbabel/config.h.in +++ b/gpsbabel/config.h.in @@ -1,5 +1,8 @@ /* config.h.in. Generated from configure.in by autoheader. */ +/* "0 for most-used character sets" */ +#undef CET_WANTED + /* Defined if you have libexpat */ #undef HAVE_LIBEXPAT diff --git a/gpsbabel/configure b/gpsbabel/configure index b154f56de..bbcf16106 100755 --- a/gpsbabel/configure +++ b/gpsbabel/configure @@ -804,6 +804,11 @@ if test -n "$ac_init_help"; then esac cat <<\_ACEOF +Optional Packages: + --with-PACKAGE[=ARG] use PACKAGE [ARG=yes] + --without-PACKAGE do not use PACKAGE (same as --with-PACKAGE=no) +--with-cet=(default,all,minimal) + Some influential environment variables: CC C compiler command CFLAGS C compiler flags @@ -2492,6 +2497,31 @@ _ACEOF fi +#AC_ARG_ENABLE(allcet, "Enable all character sets", AC_DEFINE(WANT_ALLCET, 1, [Define if you want support for all known character sets])) +#AC_ARG_ENABLE(cet, "Enable character sets=(default,all,minimal)") + +# Check whether --with-cet or --without-cet was given. +if test "${with_cet+set}" = set; then + withval="$with_cet" + cet="$withval" +else + cet="default" +fi; + +if test "$cet" = "all"; then + +cat >>confdefs.h <<\_ACEOF +#define CET_WANTED 1 +_ACEOF + +fi +if test "$cet" = "default"; then + +cat >>confdefs.h <<\_ACEOF +#define CET_WANTED 0 +_ACEOF + +fi case "$target" in *-*-cygwin* | *-*-mingw32*) @@ -2637,11 +2667,19 @@ echo "$as_me: error: libusb >= 0.1.8 is needed" >&2;} fi + # Override libusb for Darwin to reduce external + # runtime requirement. + case "$target" in + *-*-darwin*) + if test "x$ac_cv_lib_usb_usb_interrupt_read" = "xyes" ; then + USB_LIBS="`libusb-config --prefix`/lib/libusb.a -framework IOKit -framework CoreFoundation" + fi + esac OSJEEPS=jeeps/gpslibusb.o CFLAGS="$OCFLAGS" # LIBS="$LIBS `libusb-config --libs`" fi - ;; + ;; esac @@ -2661,14 +2699,22 @@ echo "${ECHO_T}check not done" >&6 else # Special case fink test. - if test -f /sw/include/expat.h; then - CFLAGS="$CFLAGS -I/sw/include" - fi - if test -f /sw/include/expat.h; then - LDFLAGS="$LDFLAGS -L/sw/lib" - fi + case "$target" in + *-*-darwin*) + if test -f /sw/include/expat.h -a -f /sw/include/expat.h; then + CFLAGS="$CFLAGS -I/sw/include" + LDFLAGS="$LDFLAGS -L/sw/lib" + # Static link against expat archive, not dyn lib. - echo "$as_me:$LINENO: checking for XML_ParserCreate in -lexpat" >&5 +cat >>confdefs.h <<\_ACEOF +#define HAVE_LIBEXPAT 1 +_ACEOF + + EXPAT_LIB=/sw/lib/libexpat.a + fi + ;; + *) + echo "$as_me:$LINENO: checking for XML_ParserCreate in -lexpat" >&5 echo $ECHO_N "checking for XML_ParserCreate in -lexpat... $ECHO_C" >&6 if test "${ac_cv_lib_expat_XML_ParserCreate+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 @@ -2738,9 +2784,12 @@ cat >>confdefs.h <<\_ACEOF #define HAVE_LIBEXPAT 1 _ACEOF - EXPAT_LIB="$LDFLAGS -lexpat" + EXPAT_LIB="$LDFLAGS -lexpat" fi + + ;; + esac fi diff --git a/gpsbabel/configure.in b/gpsbabel/configure.in index db8274bfb..6047dba63 100644 --- a/gpsbabel/configure.in +++ b/gpsbabel/configure.in @@ -20,6 +20,15 @@ AC_SUBST(AC_EXEEXT) # Checks for libraries. AC_CHECK_LIB([m], [cos]) +AC_ARG_WITH(cet,[--with-cet=(default,all,minimal)], + cet="$withval", cet="default") + +if test "$cet" = "all"; then + AC_DEFINE(CET_WANTED, 1, "1 for all character sets") +fi +if test "$cet" = "default"; then + AC_DEFINE(CET_WANTED, 0, "0 for most-used character sets") +fi case "$target" in *-*-cygwin* | *-*-mingw32*) -- 2.30.2